<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <script>
  //1.之前的方式
  function foo1() {//函数定义

  }
  //2.函数表达式
  var foo2 = function(name,age) {
    console.log("函数体代码")
    console.log(name,age)

  }
  //3.箭头函数
  var foo3 = (name,age) => {
    console.log("箭头函数的函数体")
    console.log(name,age)

  }
  //箭头函数的练习
  var names = ["abc","cba","nba"]
  names.forEach((item,index,arr)=>{
    console.log(item,index,arr)
  }) 
  //3.2 setTimeout
  setTimeout(()=>{
      console.log("setTimeout")
      console.log("哈哈哈哈哈")
  },3000)
  </script>
</body>
</html>